package com.kele.call;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * @author kele
 * @date 2021/10/11 15:14
 * @description callable创建线程
 */
public class CallableTest {
    public static void main(String[] args) {
        MyThread myThread=new MyThread();
        FutureTask<String> futureTask=new FutureTask<>(myThread);
        Thread thread=new Thread(futureTask);
        thread.start();
    }
}
class MyThread implements Callable<String>{

    @Override
    public String call() throws Exception {
        System.out.println("hello callable");
        return "hello callable";
    }
}
